# Maintainer: Alberto Fanjul Alonso <albfan@gnome.org>

_realname=akira
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.0.16
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64')
pkgdesc="Akira is a native Linux Design application built in Vala and GTK. (mingw-w64)"
depends=( "${MINGW_PACKAGE_PREFIX}-granite"
          "${MINGW_PACKAGE_PREFIX}-elementary-icon-theme"
          "${MINGW_PACKAGE_PREFIX}-gtk-elementary-theme"
          "${MINGW_PACKAGE_PREFIX}-libarchive"
          "${MINGW_PACKAGE_PREFIX}-goocanvas")
makedepends=("${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-itstool")
options=('strip')
license=("GPL3")
url="https://github.com/akiraux/Akira"
source=("${_realname}-${pkgver}.tar.gz::https://github.com/akiraux/Akira/archive/v${pkgver}.tar.gz"
        Avoid-open-cmd-terminal-running-on-windows.patch)
sha256sums=('7740358ac2cd5de2a1d7a4c7cbd25a852c2dcb6b71f442a0280b160f6f4c6ada'
            '257ace23a5e69cf4a724473073e8933b0f01ca65f4a06845f71ffaf3d511aada')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -N -p1 -i "${srcdir}/Avoid-open-cmd-terminal-running-on-windows.patch"
}

build() {
  [[ -d build-${MINGW_CHOST} ]] && rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  meson \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dwerror=false \
    ../${_realname}-${pkgver}

  meson compile
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  DESTDIR="${pkgdir}" meson install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
